昨天我們講到了利用迴圈製作有規則的波普小作品,今天我們要來加入隨機值操作看看,用昨天的程式來稍微改造一下
let nn = 0
let bb = 0
let palette2 = ["#2E294E", "#541388", "#F1E9DA", "#FFD400", "#D90368"];
let palette = ["#3AC3FD", "#2988B1", "#FD3AA3", "#B12972", "#FDE33A"];
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
noStroke()
noLoop()
start()
}
function draw() {
colorMode(RGB);
let cc = color(255,215,0)
cc.setAlpha(200);
fill(cc)
push()
rotate(-0.25);
rect(1150, 180, 800, 550)
pop()
let CCCC = color('#292a73')
CCCC.setAlpha(170);
fill(CCCC)
triangle(640, 440 ,1200, 1000, 180, 600)
}
function start(){
//用同一章畫布
for (let k = 0; k < width; k+=20) {
bb += k/10;
for(let i = 0; i< width ; i+=10) {
let colorBall = parseInt( random(0, 5))
fill(palette[colorBall])
let noiseTemp = noise(0.03 * i, 0.03 * i)
let noiseTemp2 = noise(0.04 * i, 0.05 * i)
let newX = map(noiseTemp,0,1, 0 ,width)
let newY = map(noiseTemp2,0,1, 0 , height)
ellipse( newX , newY - bb , k/random(20, 40)) //上半部
ellipse( newX , newY + bb , k/random(20, 40)) //上半部
}
}
}
身為排版苦手的我,覺得上層上什麼都不對,最後只好自暴自棄隨意地放了兩個幾何,大家有覺得好看的排版可以在跟我分享一下XD